from rest_framework import serializers

# from apps.setup.models import Organizations, Userinfo, Experts, Timeslot,Colleges
from apps.setup.models import *


class CollegesSerializer(serializers.ModelSerializer):
    class Meta:
        model = Colleges
        fields = ('collegename',)


class ExpertsSerializers(serializers.ModelSerializer):
    create_time = serializers.DateTimeField('%Y-%m-%d %H:%M')

    class Meta:
        model = Experts
        fields = ('experts_id', 'experts_name', 'user_id', 'careerplan_count', 'create_time', 'status')


class OrganizationsSerializer(serializers.ModelSerializer):
    parenttoid = CollegesSerializer()

    class Meta:
        model = Organizations
        fields = ('orgname', 'organization_id', 'parenttoid')


class TimesLotSerializer(serializers.ModelSerializer):
    create_time = serializers.DateTimeField('%Y-%m-%d %H:%M')

    class Meta:
        model = Timeslot
        fields = ('timeslot_id', 'name', 'timeslot_count', 'create_time', 'status')


class UserInfoSerializer(serializers.ModelSerializer):
    organization = OrganizationsSerializer()

    class Meta:
        model = Userinfo
        fields = ('userinfo_id','organization', 'sex', 'age', 'pic', 'placeoforigin', 'nation', 'politicalvisage', 'qqnumber')
